<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>列表页</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel='stylesheet' href='/stylesheets/signin.css' />
    <style>
      .pad{
        padding-top: 50px;
      }
    </style>
</head>
<body>
     <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/">首页</a>
        </div>
        
        <div id="navbar" class=" navbar-right">
            <%if(!data.phone){%>
              <a class="navbar-brand" href="/login">登录</a>
              <a class="navbar-brand" href="/register">注册</a>
            <%}else{%>
              <a class="navbar-brand">你好：<%= data.phone %></a>
              <a class="navbar-brand" href="/logout">退出</a>
            <%}%>
        </div>
      </div>
    </nav>

    <div class="pad"></div>
     <div  class="container" id="hot">
      <% data.list.forEach(function(item,index){%>
          <div class="col-sm-2 col-xs-6" style="height:180px">
            <a href="/movie/detail?id=<%=item.id%>" class="item" target="_self">
              <div class="img-outer">
                <div class="img-inner">
                  <img class="card-img lazy" data-original="/Public/img/apollo.jpg" alt="Card image" src="<%=item.images.medium%>" style="display: inline;">
                  <div class="card-img-bottomlay">
                    <%= item.title %> 
                  </div>
                </div>
              </div>
            </a>
          </div>
        <% })%>
    </div>


    <nav aria-label="Page navigation" style="text-align:center">
        <ul class="pagination">
            <li>
            <a href="/movie/list?collection=<%=data.table%>&pageNo=<%=data.pageNo > 1 ?  parseInt(data.pageNo)-1: 1 %>" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
            </li>
            <%for(var i=1;i<=data.totalPages;i++){%>
            
                <li><a href="/movie/list?collection=<%=data.table%>&pageNo=<%=i%>"><%=i%></a></li>
            <%}%>
            <li>
            <a href="/movie/list?collection=<%=data.table%>&pageNo=<%=data.pageNo < data.totalPages ?  parseInt(data.pageNo)+1: data.totalPages %>" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
            </li>
        </ul>
    </nav>
</body>
</html>